<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 500px;
            height: 200px;
            background-color: aquamarine;
        }
    </style>
</head>
<body>
    <div></div>
    <!-- 1.设置元素样式属性通过style属性引出来 -->
    <!-- 如果需要修改带有横线的样式要改为驼峰法 -->
    <script>
        //1.获取元素对象
        let sty=document.querySelector('div')
        //2.修改元素对象属性
        sty.style.width='50px'
        sty.style.backgroundColor='red'
    </script>
</body>
</html>